<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Grupo12daturma2MIEIC4: C:/Users/Paulo/Documents/FEUP/EclipseWorkSpace/calgrafos/src/Empresa.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Gerado por Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Localizar');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Grupo12daturma2MIEIC4&#160;<span id="projectnumber">1.0</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Página&#160;principal</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Ficheiros</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Localizar" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Lista&#160;de&#160;ficheiros</span></a></li>
      <li><a href="globals.html"><span>Ficheiros&#160;membro</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('_empresa_8cpp.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">C:/Users/Paulo/Documents/FEUP/EclipseWorkSpace/calgrafos/src/Empresa.cpp</div>  </div>
</div>
<div class="contents">
<a href="_empresa_8cpp.html">Ir para a documentação deste ficheiro.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//============================================================================</span>
<a name="l00002"></a>00002 <span class="comment">// Nome        : Empresa.cpp</span>
<a name="l00003"></a>00003 <span class="comment">// Autores     : T1G7</span>
<a name="l00004"></a>00004 <span class="comment">//                                      Felipe Galvão do Espírito Santo</span>
<a name="l00005"></a>00005 <span class="comment">//                                      Ivanilda Maísa Costa Brazão de Almeida</span>
<a name="l00006"></a>00006 <span class="comment">//                                      Paulo Jorge de Faria dos Reis</span>
<a name="l00007"></a>00007 <span class="comment">// Versão      : 1.0</span>
<a name="l00008"></a>00008 <span class="comment">// Data        : Maio de 2011</span>
<a name="l00009"></a>00009 <span class="comment">// Copyright   : Creative Commons 2.0</span>
<a name="l00010"></a>00010 <span class="comment">// Descrição   : CAL 2011 - TG1</span>
<a name="l00011"></a>00011 <span class="comment">//               Tema 12 - Transporte de pacientes de uma clínica de saúde.</span>
<a name="l00012"></a>00012 <span class="comment">//============================================================================</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="preprocessor">#include &quot;<a class="code" href="_empresa_8h.html">Empresa.h</a>&quot;</span>
<a name="l00015"></a>00015 
<a name="l00016"></a><a class="code" href="_empresa_8cpp.html#abba3d603fe60469db652a2050724f83f">00016</a> <span class="preprocessor">#define SEPARADOR &quot;|&quot;</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span>
<a name="l00018"></a>00018 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_empresa.html#a2cfc4dcbf64fc7207e4d59519218db18" title="Dados privados.">Empresa::instancias</a> = 0;
<a name="l00019"></a>00019 
<a name="l00021"></a><a class="code" href="class_empresa.html#a20d82aef867ea1edc24d8ffc1f6182ef">00021</a> <a class="code" href="class_empresa.html#a20d82aef867ea1edc24d8ffc1f6182ef" title="Funções públicas.">Empresa::Empresa</a>(<span class="keywordtype">string</span> ficheiro, <span class="keywordtype">int</span> permissoes) {
<a name="l00022"></a>00022         <span class="comment">//TODO abrir ficheiro arquivo</span>
<a name="l00023"></a>00023         <span class="keywordtype">int</span> sucesso;
<a name="l00024"></a>00024         <a class="code" href="class_empresa.html#a498bb9d730ccb0c5de187676e8b05938" title="A classe de Interface deve conseguir aceder aos dados de Aplicação.">arquivo</a> = ficheiro;                                     
<a name="l00025"></a>00025         sucesso = <a class="code" href="class_empresa.html#a7d28d4ddfa07998b4dce3eb4f9f14bca" title="Está na moda as palavras começadas por i... a sério: significa Interface em Texto.">iData</a>.<a class="code" href="class_dados.html#ac4977f65eb712db8e6be23d024855f0c" title="Recupera a informa��o previamente guardada num ficheiro reconstruindo toda a estrutura de dados...">carregarDados</a>(<a class="code" href="class_empresa.html#a498bb9d730ccb0c5de187676e8b05938" title="A classe de Interface deve conseguir aceder aos dados de Aplicação.">arquivo</a>, <a class="code" href="_empresa_8cpp.html#abba3d603fe60469db652a2050724f83f">SEPARADOR</a>);      
<a name="l00026"></a>00026         <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#a84ca868fe09a5fe9bc1baa36a1ddbf74" title="Texto de ajuda da interface.">ligarDados</a>(<a class="code" href="class_empresa.html#a7d28d4ddfa07998b4dce3eb4f9f14bca" title="Está na moda as palavras começadas por i... a sério: significa Interface em Texto.">iData</a>);                                 
<a name="l00027"></a>00027         <a class="code" href="class_empresa.html#a1cf630e1978a80fdc97ddadf02af81d0" title="Quantidade de instâncias que estão a ser executadas.">instancia</a> = ++(<a class="code" href="class_empresa.html#a2cfc4dcbf64fc7207e4d59519218db18" title="Dados privados.">Empresa::instancias</a>);
<a name="l00028"></a>00028 }
<a name="l00029"></a>00029 
<a name="l00030"></a><a class="code" href="class_empresa.html#a3c03ed7fbfdaa5c8db9b8587451f1326">00030</a> <a class="code" href="class_empresa.html#a3c03ed7fbfdaa5c8db9b8587451f1326" title="O construtor precisa de saber qual o ficheiro de arquivo dos dados. Valor por defeito 1...">Empresa::~Empresa</a>() {
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 }
<a name="l00033"></a>00033 
<a name="l00034"></a><a class="code" href="class_empresa.html#adcb87faf1a2528dfcdd9b4854d1fc70f">00034</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#adcb87faf1a2528dfcdd9b4854d1fc70f" title="Inicio da aplicação. Lança a interface com o utilizador.">Empresa::terminar</a>()
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036 exit(1);
<a name="l00037"></a>00037 }
<a name="l00038"></a>00038 
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="comment">// Menu principal</span>
<a name="l00041"></a><a class="code" href="class_empresa.html#a42179edb167fd7727686935df1468ad7">00041</a> <span class="keywordtype">int</span> <a class="code" href="class_empresa.html#a42179edb167fd7727686935df1468ad7">Empresa::iniciar</a>() {
<a name="l00042"></a>00042 
<a name="l00043"></a>00043         <span class="keywordtype">string</span> escolha;
<a name="l00044"></a>00044 
<a name="l00046"></a>00046         vector&lt;string&gt; aMostrar;
<a name="l00047"></a>00047         aMostrar.push_back(<span class="stringliteral">&quot;Tema 12&quot;</span>);
<a name="l00048"></a>00048         aMostrar.push_back(<span class="stringliteral">&quot;separador&quot;</span>);
<a name="l00049"></a>00049         aMostrar.push_back(<span class="stringliteral">&quot;1 - Gestão de Clientes.&quot;</span>);
<a name="l00050"></a>00050         aMostrar.push_back(<span class="stringliteral">&quot;2 - Gestão de Veiculos.&quot;</span>);
<a name="l00051"></a>00051         aMostrar.push_back(<span class="stringliteral">&quot;3 - Gestão de Sucursais.&quot;</span>);
<a name="l00052"></a>00052         aMostrar.push_back(<span class="stringliteral">&quot;4 - Gestão de Consultas.&quot;</span>);
<a name="l00053"></a>00053         aMostrar.push_back(<span class="stringliteral">&quot;5 - Gestão de Rotas.&quot;</span>);
<a name="l00054"></a>00054         aMostrar.push_back(<span class="stringliteral">&quot;9 - Ajuda.&quot;</span>);
<a name="l00055"></a>00055         aMostrar.push_back(<span class="stringliteral">&quot;0 - Sair.&quot;</span>);
<a name="l00056"></a>00056         <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#a45db23c49c70b5ba544d3063b8ededf6" title="Limpa o ecran.">menuNaConsola</a>(aMostrar);
<a name="l00057"></a>00057         escolha = <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ab7bb92645a853a980bdd19553b6faa22" title="Utilizado para enviar mensagem para a consola.">smsRetorno</a>(<span class="stringliteral">&quot;Escolha a opção pretendida:&quot;</span>);
<a name="l00058"></a>00058 
<a name="l00059"></a>00059 
<a name="l00060"></a>00060         <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;0&quot;</span>)
<a name="l00061"></a>00061         {
<a name="l00062"></a>00062                 <a class="code" href="class_empresa.html#adcb87faf1a2528dfcdd9b4854d1fc70f" title="Inicio da aplicação. Lança a interface com o utilizador.">terminar</a>();             
<a name="l00063"></a>00063                 <span class="keywordflow">return</span> 0;
<a name="l00064"></a>00064         }
<a name="l00065"></a>00065         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;1&quot;</span>)
<a name="l00066"></a>00066                 <a class="code" href="class_empresa.html#a4ab0d00ec5bed9072ca31ecd4874879a" title="Termina a aplicação, gravando antes os dados para ficheiro.">gestaoClientes</a>();               
<a name="l00067"></a>00067         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;2&quot;</span>)
<a name="l00068"></a>00068                 <a class="code" href="class_empresa.html#ac75d488cb5afb6dfd89c0a0d4d98b597">gestaoVeiculos</a>();               
<a name="l00069"></a>00069         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;3&quot;</span>)
<a name="l00070"></a>00070                 <a class="code" href="class_empresa.html#affc82ada3400e920c065023d01014a1e">gestaoSucursal</a>();               
<a name="l00071"></a>00071         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;4&quot;</span>)
<a name="l00072"></a>00072                 <a class="code" href="class_empresa.html#a02a0e5fddb9c7f6ba9e863ab408a26a4">gestaoConsultas</a>();              
<a name="l00073"></a>00073         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;5&quot;</span>)
<a name="l00074"></a>00074                 <a class="code" href="class_empresa.html#a9692aa887b6e73477b35b3356ec64a0b">gestaoRotas</a>();                  
<a name="l00075"></a>00075         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;9&quot;</span>)
<a name="l00076"></a>00076                 <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ae56d80cd0d0aa6d194eba699e816e1b6" title="Apresenta um menu previamente criado.">ajuda</a>(<span class="stringliteral">&quot;menuPrincipal&quot;</span>); 
<a name="l00077"></a>00077         <span class="keywordflow">else</span>
<a name="l00078"></a>00078                 <a class="code" href="class_empresa.html#a42179edb167fd7727686935df1468ad7">iniciar</a>();
<a name="l00079"></a>00079 
<a name="l00080"></a>00080         <span class="keywordflow">return</span> 0; 
<a name="l00081"></a>00081 }
<a name="l00082"></a>00082 
<a name="l00083"></a>00083 <span class="comment">// Gestão de Clientes</span>
<a name="l00084"></a><a class="code" href="class_empresa.html#a4ab0d00ec5bed9072ca31ecd4874879a">00084</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#a4ab0d00ec5bed9072ca31ecd4874879a" title="Termina a aplicação, gravando antes os dados para ficheiro.">Empresa::gestaoClientes</a>()
<a name="l00085"></a>00085 {
<a name="l00086"></a>00086         <span class="keywordtype">string</span> escolha;
<a name="l00087"></a>00087 
<a name="l00088"></a>00088         <span class="comment">//Preparação do Menu Gestão de  Clientes.</span>
<a name="l00089"></a>00089         vector&lt;string&gt; aMostrar;
<a name="l00090"></a>00090         aMostrar.push_back(<span class="stringliteral">&quot;Gestão de Clientes&quot;</span>);
<a name="l00091"></a>00091         aMostrar.push_back(<span class="stringliteral">&quot;separador&quot;</span>);
<a name="l00092"></a>00092         aMostrar.push_back(<span class="stringliteral">&quot;1 - Registar Clientes.&quot;</span>);
<a name="l00093"></a>00093         aMostrar.push_back(<span class="stringliteral">&quot;2 - Alterar Clientes.&quot;</span>);
<a name="l00094"></a>00094         aMostrar.push_back(<span class="stringliteral">&quot;3 - Desativar Clientes.&quot;</span>);
<a name="l00095"></a>00095         aMostrar.push_back(<span class="stringliteral">&quot;4 - Consultar Clientes.&quot;</span>);
<a name="l00096"></a>00096         aMostrar.push_back(<span class="stringliteral">&quot;9 - Ajuda.&quot;</span>);
<a name="l00097"></a>00097         aMostrar.push_back(<span class="stringliteral">&quot;0 - Sair.&quot;</span>);
<a name="l00098"></a>00098         <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#a45db23c49c70b5ba544d3063b8ededf6" title="Limpa o ecran.">menuNaConsola</a>(aMostrar);
<a name="l00099"></a>00099         escolha = <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ab7bb92645a853a980bdd19553b6faa22" title="Utilizado para enviar mensagem para a consola.">smsRetorno</a>(<span class="stringliteral">&quot;Escolha a opção pretendida:&quot;</span>);
<a name="l00100"></a>00100 
<a name="l00101"></a>00101 
<a name="l00102"></a>00102         <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;0&quot;</span>)
<a name="l00103"></a>00103                 {
<a name="l00104"></a>00104                         <a class="code" href="class_empresa.html#a42179edb167fd7727686935df1468ad7">iniciar</a>();                                              
<a name="l00105"></a>00105                 }
<a name="l00106"></a>00106                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;1&quot;</span>)
<a name="l00107"></a>00107                         <a class="code" href="class_empresa.html#a1b2752881f37f97f0057c501f805981c" title="Funções relativas a Clientes.">registarCliente</a>();                              
<a name="l00108"></a>00108                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;2&quot;</span>)
<a name="l00109"></a>00109                         <a class="code" href="class_empresa.html#ac8e1e8dcfd1cb6291d4d84bdd90eba00" title="Função para alterar os dados do Cliente.">alterarCliente</a>();                               
<a name="l00110"></a>00110                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;3&quot;</span>)
<a name="l00111"></a>00111                         <a class="code" href="class_empresa.html#a84f868705fc0e2cad181201b79b9ba66">desativarCliente</a>();                     
<a name="l00112"></a>00112                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;4&quot;</span>)
<a name="l00113"></a>00113                         <a class="code" href="class_empresa.html#af08b4a3b0d5d1e61b5be2c818fcf56e3">consultarCliente</a>();                     
<a name="l00114"></a>00114                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;9&quot;</span>)
<a name="l00115"></a>00115                         <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ae56d80cd0d0aa6d194eba699e816e1b6" title="Apresenta um menu previamente criado.">ajuda</a>(<span class="stringliteral">&quot;menuPrincipal&quot;</span>);    
<a name="l00116"></a>00116                 <span class="keywordflow">else</span>
<a name="l00117"></a>00117 
<a name="l00118"></a>00118                         <a class="code" href="class_empresa.html#a4ab0d00ec5bed9072ca31ecd4874879a" title="Termina a aplicação, gravando antes os dados para ficheiro.">gestaoClientes</a>();
<a name="l00119"></a>00119 
<a name="l00120"></a>00120 }
<a name="l00121"></a>00121 
<a name="l00122"></a>00122 <span class="comment">// Gestão de Veiculos</span>
<a name="l00123"></a><a class="code" href="class_empresa.html#ac75d488cb5afb6dfd89c0a0d4d98b597">00123</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#ac75d488cb5afb6dfd89c0a0d4d98b597">Empresa::gestaoVeiculos</a>()
<a name="l00124"></a>00124 {
<a name="l00125"></a>00125             <span class="keywordtype">string</span> escolha;
<a name="l00126"></a>00126 
<a name="l00127"></a>00127                 <span class="comment">//Preparação do Menu Gestão de  Veículos.</span>
<a name="l00128"></a>00128                 vector&lt;string&gt; aMostrar;
<a name="l00129"></a>00129                 aMostrar.push_back(<span class="stringliteral">&quot;Gestão de Veículos&quot;</span>);
<a name="l00130"></a>00130                 aMostrar.push_back(<span class="stringliteral">&quot;separador&quot;</span>);
<a name="l00131"></a>00131                 aMostrar.push_back(<span class="stringliteral">&quot;1 - Capacidade do Veiculo.&quot;</span>);
<a name="l00132"></a>00132                 aMostrar.push_back(<span class="stringliteral">&quot;2 - Clientes Alocados.&quot;</span>);
<a name="l00133"></a>00133                 <span class="comment">//aMostrar.push_back(&quot;3 - Sucursal Associado.&quot;);</span>
<a name="l00134"></a>00134                 <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#a45db23c49c70b5ba544d3063b8ededf6" title="Limpa o ecran.">menuNaConsola</a>(aMostrar);
<a name="l00135"></a>00135                 escolha = <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ab7bb92645a853a980bdd19553b6faa22" title="Utilizado para enviar mensagem para a consola.">smsRetorno</a>(<span class="stringliteral">&quot;Escolha a opção pretendida:&quot;</span>);
<a name="l00136"></a>00136 
<a name="l00137"></a>00137 
<a name="l00138"></a>00138                 <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;0&quot;</span>)
<a name="l00139"></a>00139                         {
<a name="l00140"></a>00140                                 <a class="code" href="class_empresa.html#a42179edb167fd7727686935df1468ad7">iniciar</a>();                                                      
<a name="l00141"></a>00141                         }
<a name="l00142"></a>00142                         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;1&quot;</span>)
<a name="l00143"></a>00143                                 <a class="code" href="class_empresa.html#ac8d3747ee3c0b218839a866a2ec4ab7f" title="Funções relativas a Veiculos.">capacidadeVeiculo</a>();                            
<a name="l00144"></a>00144                         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;2&quot;</span>)
<a name="l00145"></a>00145                              <a class="code" href="class_empresa.html#a74fd5a055a7ecefaf246fce9a838fd01">clientesAlocados</a>();                                
<a name="l00146"></a>00146                         <span class="comment">//else if (escolha == 3)</span>
<a name="l00147"></a>00147 
<a name="l00148"></a>00148                                 <span class="comment">// sucursalAssociado();                         //!  A sucursal a que o veiculo pertence.</span>
<a name="l00149"></a>00149                         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;9&quot;</span>)
<a name="l00150"></a>00150                                         <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ae56d80cd0d0aa6d194eba699e816e1b6" title="Apresenta um menu previamente criado.">ajuda</a>(<span class="stringliteral">&quot;menuPrincipal&quot;</span>);     
<a name="l00151"></a>00151                         <span class="keywordflow">else</span>
<a name="l00152"></a>00152                                 <a class="code" href="class_empresa.html#ac75d488cb5afb6dfd89c0a0d4d98b597">gestaoVeiculos</a>();
<a name="l00153"></a>00153 
<a name="l00154"></a>00154 
<a name="l00155"></a>00155 }
<a name="l00156"></a>00156 
<a name="l00157"></a>00157 <span class="comment">// Gestão de sucursais</span>
<a name="l00158"></a><a class="code" href="class_empresa.html#affc82ada3400e920c065023d01014a1e">00158</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#affc82ada3400e920c065023d01014a1e">Empresa::gestaoSucursal</a>()
<a name="l00159"></a>00159 {
<a name="l00160"></a>00160                 <span class="keywordtype">string</span> escolha;
<a name="l00161"></a>00161 
<a name="l00162"></a>00162                 <span class="comment">//Preparação do Menu Gestão de  Sucursais.</span>
<a name="l00163"></a>00163                 vector&lt;string&gt; aMostrar;
<a name="l00164"></a>00164                 aMostrar.push_back(<span class="stringliteral">&quot;Gestão de Sucursais&quot;</span>);
<a name="l00165"></a>00165                 aMostrar.push_back(<span class="stringliteral">&quot;separador&quot;</span>);
<a name="l00166"></a>00166                 aMostrar.push_back(<span class="stringliteral">&quot;1 - Clientes da Sucursal.&quot;</span>);
<a name="l00167"></a>00167                 aMostrar.push_back(<span class="stringliteral">&quot;2 - Veiculo da Sucursal.&quot;</span>);
<a name="l00168"></a>00168                 aMostrar.push_back(<span class="stringliteral">&quot;3 - Desativar Sucursal.&quot;</span>);
<a name="l00169"></a>00169                 aMostrar.push_back(<span class="stringliteral">&quot;9 - Ajuda.&quot;</span>);
<a name="l00170"></a>00170                 aMostrar.push_back(<span class="stringliteral">&quot;0 - Sair.&quot;</span>);
<a name="l00171"></a>00171                 <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#a45db23c49c70b5ba544d3063b8ededf6" title="Limpa o ecran.">menuNaConsola</a>(aMostrar);
<a name="l00172"></a>00172                 escolha = <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ab7bb92645a853a980bdd19553b6faa22" title="Utilizado para enviar mensagem para a consola.">smsRetorno</a>(<span class="stringliteral">&quot;Escolha a opção pretendida:&quot;</span>);
<a name="l00173"></a>00173 
<a name="l00174"></a>00174                 <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;0&quot;</span>)
<a name="l00175"></a>00175                         {
<a name="l00176"></a>00176                                 <a class="code" href="class_empresa.html#a42179edb167fd7727686935df1468ad7">iniciar</a>();                                      
<a name="l00177"></a>00177                         }
<a name="l00178"></a>00178                         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;1&quot;</span>)
<a name="l00179"></a>00179                                 <a class="code" href="class_empresa.html#a0eec8d0106205143940e59f54b3651be" title="Funções relativas as Sucursais.">listaClientes</a>();                        
<a name="l00180"></a>00180                         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;2&quot;</span>)
<a name="l00181"></a>00181                                 <a class="code" href="class_empresa.html#a5a4c537bff70f5d659ff08ee1f498748">veiculoAssociado</a>();             
<a name="l00182"></a>00182                         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;3&quot;</span>)
<a name="l00183"></a>00183                                 <a class="code" href="class_empresa.html#a99387cca71e4cc5563c3836aabb7ddf7">desativarSucursal</a>();            
<a name="l00184"></a>00184                         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;9&quot;</span>)
<a name="l00185"></a>00185                                 <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ae56d80cd0d0aa6d194eba699e816e1b6" title="Apresenta um menu previamente criado.">ajuda</a>(<span class="stringliteral">&quot;menuPrincipal&quot;</span>);    
<a name="l00186"></a>00186                         <span class="keywordflow">else</span>
<a name="l00187"></a>00187                                 <a class="code" href="class_empresa.html#affc82ada3400e920c065023d01014a1e">gestaoSucursal</a>();
<a name="l00188"></a>00188 }
<a name="l00189"></a>00189 
<a name="l00190"></a>00190 <span class="comment">// Gestão de Consultas</span>
<a name="l00191"></a><a class="code" href="class_empresa.html#a02a0e5fddb9c7f6ba9e863ab408a26a4">00191</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#a02a0e5fddb9c7f6ba9e863ab408a26a4">Empresa::gestaoConsultas</a>()
<a name="l00192"></a>00192 {
<a name="l00193"></a>00193         <span class="keywordtype">string</span> escolha;
<a name="l00194"></a>00194 
<a name="l00195"></a>00195         <span class="comment">//Preparação do Menu Gestão de  Clientes.</span>
<a name="l00196"></a>00196         vector&lt;string&gt; aMostrar;
<a name="l00197"></a>00197         aMostrar.push_back(<span class="stringliteral">&quot;Consultas&quot;</span>);
<a name="l00198"></a>00198         aMostrar.push_back(<span class="stringliteral">&quot;separador&quot;</span>);
<a name="l00199"></a>00199         aMostrar.push_back(<span class="stringliteral">&quot;1 - Escolher Cliente.&quot;</span>);
<a name="l00200"></a>00200         aMostrar.push_back(<span class="stringliteral">&quot;9 - Ajuda.&quot;</span>);
<a name="l00201"></a>00201         aMostrar.push_back(<span class="stringliteral">&quot;0 - Sair.&quot;</span>);
<a name="l00202"></a>00202         <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#a45db23c49c70b5ba544d3063b8ededf6" title="Limpa o ecran.">menuNaConsola</a>(aMostrar);
<a name="l00203"></a>00203         escolha = <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ab7bb92645a853a980bdd19553b6faa22" title="Utilizado para enviar mensagem para a consola.">smsRetorno</a>(<span class="stringliteral">&quot;Escolha a opção pretendida:&quot;</span>);
<a name="l00204"></a>00204 
<a name="l00205"></a>00205 
<a name="l00206"></a>00206         <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;0&quot;</span>)
<a name="l00207"></a>00207                 {
<a name="l00208"></a>00208                         <a class="code" href="class_empresa.html#a42179edb167fd7727686935df1468ad7">iniciar</a>();                                              
<a name="l00209"></a>00209                 }
<a name="l00210"></a>00210                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;1&quot;</span>)
<a name="l00211"></a>00211                         <a class="code" href="class_empresa.html#a6b2518be0de3cfe79f94cfaf2c50f0ad" title="Funções relativas as Consultas.">dadosCliente</a>();                                 
<a name="l00212"></a>00212                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;9&quot;</span>)
<a name="l00213"></a>00213                         <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ae56d80cd0d0aa6d194eba699e816e1b6" title="Apresenta um menu previamente criado.">ajuda</a>(<span class="stringliteral">&quot;menuPrincipal&quot;</span>);    
<a name="l00214"></a>00214                 <span class="keywordflow">else</span>
<a name="l00215"></a>00215 
<a name="l00216"></a>00216                         <a class="code" href="class_empresa.html#a02a0e5fddb9c7f6ba9e863ab408a26a4">gestaoConsultas</a>();
<a name="l00217"></a>00217 }
<a name="l00218"></a>00218 
<a name="l00219"></a>00219 <span class="comment">// Gestão de Rotas</span>
<a name="l00220"></a><a class="code" href="class_empresa.html#a9692aa887b6e73477b35b3356ec64a0b">00220</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#a9692aa887b6e73477b35b3356ec64a0b">Empresa::gestaoRotas</a>()
<a name="l00221"></a>00221 {
<a name="l00222"></a>00222         <span class="keywordtype">string</span> escolha;
<a name="l00223"></a>00223         vector&lt;string&gt; aMostrar;
<a name="l00224"></a>00224         aMostrar.clear();
<a name="l00225"></a>00225         aMostrar.push_back(<span class="stringliteral">&quot;Gestão de Rotas&quot;</span>);
<a name="l00226"></a>00226         aMostrar.push_back(<span class="stringliteral">&quot;separador&quot;</span>);
<a name="l00227"></a>00227         aMostrar.push_back(<span class="stringliteral">&quot;1 - Algoritmo 1 - Uma única rota de 1 veiculo.&quot;</span>);
<a name="l00228"></a>00228         aMostrar.push_back(<span class="stringliteral">&quot;2 - Rota Algoritmo2&quot;</span>);
<a name="l00229"></a>00229         aMostrar.push_back(<span class="stringliteral">&quot;3 - Rota Algoritmo3&quot;</span>);
<a name="l00230"></a>00230         aMostrar.push_back(<span class="stringliteral">&quot;9 - Ajuda&quot;</span>);
<a name="l00231"></a>00231         aMostrar.push_back(<span class="stringliteral">&quot;0 - Sair&quot;</span>);
<a name="l00232"></a>00232         <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#a45db23c49c70b5ba544d3063b8ededf6" title="Limpa o ecran.">menuNaConsola</a>(aMostrar);
<a name="l00233"></a>00233 
<a name="l00234"></a>00234         escolha = <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ab7bb92645a853a980bdd19553b6faa22" title="Utilizado para enviar mensagem para a consola.">smsRetorno</a>(<span class="stringliteral">&quot;Escolha a opção pretendida:&quot;</span>);
<a name="l00235"></a>00235 
<a name="l00236"></a>00236         <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;0&quot;</span>)
<a name="l00237"></a>00237         {
<a name="l00238"></a>00238                 <a class="code" href="class_empresa.html#a42179edb167fd7727686935df1468ad7">iniciar</a>();
<a name="l00239"></a>00239         }
<a name="l00240"></a>00240         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;1&quot;</span>)
<a name="l00241"></a>00241                 <a class="code" href="class_empresa.html#a3ddee1dae5a517442fa258dabf14b9f6" title="Funções relativas a Rotas.">algoritmo1</a>();
<a name="l00242"></a>00242         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;2&quot;</span>)
<a name="l00243"></a>00243                 <a class="code" href="class_empresa.html#ae0b426285deeb15319c9d088c0899a8f" title="Futuro algoritmo para todas as rotas necessárias para um dia. Com redistribuição de &#39;serviço&#39; por out...">algoritmo2</a>();
<a name="l00244"></a>00244         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (escolha == <span class="stringliteral">&quot;3&quot;</span>)
<a name="l00245"></a>00245             <a class="code" href="class_empresa.html#a53039bc33c57efd950110fb0f9378698" title="Futuro algoritmo para todas as rotas necessárias para um dia. Com um veículo a realizar várias viagen...">algoritmo3</a>();
<a name="l00246"></a>00246         <span class="keywordflow">else</span>
<a name="l00247"></a>00247                 <a class="code" href="class_empresa.html#a9692aa887b6e73477b35b3356ec64a0b">gestaoRotas</a>();
<a name="l00248"></a>00248 }
<a name="l00249"></a>00249 
<a name="l00250"></a>00250 
<a name="l00252"></a>00252 
<a name="l00256"></a><a class="code" href="class_empresa.html#a1b2752881f37f97f0057c501f805981c">00256</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#a1b2752881f37f97f0057c501f805981c" title="Funções relativas a Clientes.">Empresa::registarCliente</a>() {
<a name="l00258"></a>00258         <span class="keywordtype">string</span> nome, <a class="code" href="classmorada.html" title="Ruas de um mapa.">morada</a>, teclado;
<a name="l00259"></a>00259         <span class="keywordtype">int</span> geoCoordID;
<a name="l00260"></a>00260         <span class="keywordtype">string</span> identificador; 
<a name="l00261"></a>00261         <span class="keywordtype">string</span> latitude; 
<a name="l00262"></a>00262         <span class="keywordtype">string</span> longitude; 
<a name="l00263"></a>00263         <span class="keywordtype">string</span> projX; 
<a name="l00264"></a>00264         <span class="keywordtype">string</span> projY; 
<a name="l00265"></a>00265         vector&lt;string&gt; aMostrar;
<a name="l00266"></a>00266 
<a name="l00268"></a>00268         aMostrar.clear();
<a name="l00269"></a>00269         aMostrar.push_back(<span class="stringliteral">&quot;Dados do Cliente&quot;</span>);
<a name="l00270"></a>00270         aMostrar.push_back(<span class="stringliteral">&quot;separador&quot;</span>);
<a name="l00271"></a>00271         nome = <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ab7bb92645a853a980bdd19553b6faa22" title="Utilizado para enviar mensagem para a consola.">smsRetorno</a>(<span class="stringliteral">&quot;Nome do Cliente:&quot;</span>);
<a name="l00272"></a>00272         aMostrar.push_back(nome);
<a name="l00273"></a>00273         morada = <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ab7bb92645a853a980bdd19553b6faa22" title="Utilizado para enviar mensagem para a consola.">smsRetorno</a>(<span class="stringliteral">&quot;Morada do Cliente:&quot;</span>);
<a name="l00274"></a>00274         aMostrar.push_back(morada);
<a name="l00275"></a>00275         identificador = <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ab7bb92645a853a980bdd19553b6faa22" title="Utilizado para enviar mensagem para a consola.">smsRetorno</a>(<span class="stringliteral">&quot;Identificador do cliente:&quot;</span>);
<a name="l00276"></a>00276         aMostrar.push_back(identificador);
<a name="l00277"></a>00277         latitude = <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ab7bb92645a853a980bdd19553b6faa22" title="Utilizado para enviar mensagem para a consola.">smsRetorno</a>(<span class="stringliteral">&quot;Identificador geográfico do local:&quot;</span>);
<a name="l00278"></a>00278         aMostrar.push_back(latitude);
<a name="l00279"></a>00279 
<a name="l00280"></a>00280 
<a name="l00281"></a>00281         <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#a45db23c49c70b5ba544d3063b8ededf6" title="Limpa o ecran.">menuNaConsola</a>(aMostrar);
<a name="l00282"></a>00282         teclado = <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#ab7bb92645a853a980bdd19553b6faa22" title="Utilizado para enviar mensagem para a consola.">smsRetorno</a>(<span class="stringliteral">&quot;Confirme os dados(s/n)?&quot;</span>);
<a name="l00283"></a>00283 
<a name="l00284"></a>00284         <span class="keywordflow">if</span> (teclado == <span class="stringliteral">&quot;s&quot;</span> || teclado == <span class="stringliteral">&quot;S&quot;</span>)
<a name="l00285"></a>00285         {
<a name="l00286"></a>00286                 <a class="code" href="class_empresa.html#a7d28d4ddfa07998b4dce3eb4f9f14bca" title="Está na moda as palavras começadas por i... a sério: significa Interface em Texto.">iData</a>.<a class="code" href="class_dados.html#a44104cffcaf4ed889e1eae591e40c434" title="Funções relacionadas com Clientes.">novoCliente</a>(nome, morada, identificador, latitude, longitude, projX, projY);
<a name="l00287"></a>00287 
<a name="l00288"></a>00288         }
<a name="l00289"></a>00289         <span class="keywordflow">else</span>
<a name="l00290"></a>00290         {
<a name="l00291"></a>00291                 <a class="code" href="class_empresa.html#a830b4e5bfcfccd2b61c6dd2f8a74f23f" title="ID da inst�ncia corrente.">iTex</a>.<a class="code" href="class_interfaces.html#af35a103bc29738c6caad70f17aceff55" title="Destrutor.">sms</a>(<span class="stringliteral">&quot;Os dados serão descartados.&quot;</span>);
<a name="l00292"></a>00292         }
<a name="l00293"></a>00293 }
<a name="l00294"></a>00294 
<a name="l00295"></a>00295 
<a name="l00297"></a><a class="code" href="class_empresa.html#ac8e1e8dcfd1cb6291d4d84bdd90eba00">00297</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#ac8e1e8dcfd1cb6291d4d84bdd90eba00" title="Função para alterar os dados do Cliente.">Empresa::alterarCliente</a>()
<a name="l00298"></a>00298 {
<a name="l00299"></a>00299         <span class="comment">/*string nomeCliente, confirma, escolha;</span>
<a name="l00300"></a>00300 <span class="comment">        int encontrados, indice;</span>
<a name="l00301"></a>00301 <span class="comment">        vector&lt;string&gt; aMostrar;</span>
<a name="l00302"></a>00302 <span class="comment">        vector&lt;Cliente&gt;::iterator iterCliente;</span>
<a name="l00303"></a>00303 <span class="comment">        vector&lt;vector&lt;Cliente&gt;::iterator&gt; lista;</span>
<a name="l00304"></a>00304 <span class="comment">        cin.ignore(10, &#39;\n&#39;);</span>
<a name="l00305"></a>00305 <span class="comment"></span>
<a name="l00306"></a>00306 <span class="comment">        nomeCliente = iTex.smsRetorno(&quot;Qual o nome do Cliente que pretende alterar? &quot;);</span>
<a name="l00307"></a>00307 <span class="comment"></span>
<a name="l00308"></a>00308 <span class="comment">        if(Dados.pesquisarCliente(nomeCliente, lista))          //! Faz a pesquisa, se for encontrado os resultados est�o em lista.</span>
<a name="l00309"></a>00309 <span class="comment">        {</span>
<a name="l00310"></a>00310 <span class="comment">                encontrados = lista.size();                             //! Se for encontrado mais do que um Cliente, é preciso que o utilizador escolha o que pretende.</span>
<a name="l00311"></a>00311 <span class="comment">                if(encontrados == 1) indice = 0;                //! Se for apenas 1, deve ser esse o pretendido.</span>
<a name="l00312"></a>00312 <span class="comment">                else                                                                    //! Se forem vários, é preciso escolher 1 deles.</span>
<a name="l00313"></a>00313 <span class="comment">                {</span>
<a name="l00314"></a>00314 <span class="comment">                        for(int i = 0; i &lt; encontrados; i++)</span>
<a name="l00315"></a>00315 <span class="comment">                                aMostrar.push_back(intToString(i + 1) + &quot; - &quot; + lista[i]-&gt;getnomeCliente());</span>
<a name="l00316"></a>00316 <span class="comment">                        textos.menuNaConsola(aMostrar, &#39;|&#39;, &#39;-&#39;);</span>
<a name="l00317"></a>00317 <span class="comment">                        aMostrar.clear();</span>
<a name="l00318"></a>00318 <span class="comment">                        confirma = textos.smsRetorno(&quot;Escolha o Cliente que pretende alterar (qualquer outro valor cancela a altera��o):&quot;);</span>
<a name="l00319"></a>00319 <span class="comment">                        try{indice = stringParaInteiro(confirma) - 1;}</span>
<a name="l00320"></a>00320 <span class="comment">                        catch (...){indice = -1;} //! Caso o utilizador insira algo n�o transform�vel em inteiro, �ndice = -1.</span>
<a name="l00321"></a>00321 <span class="comment">                        if(indice &gt;= encontrados or indice &lt; 0) indice = -1;//! O utilizador desistiu da altera��o, ou introduziu um valor inv�lido.</span>
<a name="l00322"></a>00322 <span class="comment">                }       //! A partir deste ponto indice � -1 ou um valor correspondente a um �ndice v�lido do vector lista.</span>
<a name="l00323"></a>00323 <span class="comment"></span>
<a name="l00325"></a>00325 <span class="comment">                if(indice != -1)        //! Mas apenas se n�o desistiu na escolha do Cliente de entre v�rios.</span>
<a name="l00326"></a>00326 <span class="comment">                {</span>
<a name="l00327"></a>00327 <span class="comment">                        aMostrar.push_back(&quot;Cliente seleccionado para altera��o&quot;);</span>
<a name="l00328"></a>00328 <span class="comment">                        aMostrar.push_back(&quot;separador&quot;);</span>
<a name="l00329"></a>00329 <span class="comment">                        lista[indice]-&gt;imprime(aMostrar);</span>
<a name="l00330"></a>00330 <span class="comment">                        iTex.menuNaConsola(aMostrar, &#39;|&#39;, &#39;-&#39;);</span>
<a name="l00331"></a>00331 <span class="comment">                        aMostrar.clear();</span>
<a name="l00332"></a>00332 <span class="comment">                        // **************************************</span>
<a name="l00334"></a>00334 <span class="comment"></span>
<a name="l00335"></a>00335 <span class="comment">                        aMostrar.push_back(&quot;Alterar Cliente&quot;);</span>
<a name="l00336"></a>00336 <span class="comment">                        aMostrar.push_back(&quot;separador&quot;);</span>
<a name="l00337"></a>00337 <span class="comment">                        aMostrar.push_back(&quot;1 - Alterar Nome&quot;);</span>
<a name="l00338"></a>00338 <span class="comment">                        aMostrar.push_back(&quot;2 - Alterar Morada&quot;);</span>
<a name="l00339"></a>00339 <span class="comment">                        aMostrar.push_back(&quot;3 - Alterar Morada_gps&quot;);</span>
<a name="l00340"></a>00340 <span class="comment">                        aMostrar.push_back(&quot;9 - Ajuda&quot;);</span>
<a name="l00341"></a>00341 <span class="comment">                        aMostrar.push_back(&quot;0 - Sair&quot;);</span>
<a name="l00342"></a>00342 <span class="comment"></span>
<a name="l00343"></a>00343 <span class="comment">                        if(escolha == &quot;0&quot;)</span>
<a name="l00344"></a>00344 <span class="comment">                                gestaoCliente();</span>
<a name="l00345"></a>00345 <span class="comment"></span>
<a name="l00346"></a>00346 <span class="comment">                        if(escolha == &quot;1&quot;)</span>
<a name="l00347"></a>00347 <span class="comment">                                alterarNomeCliente();</span>
<a name="l00348"></a>00348 <span class="comment">                        else if(escolha == &quot;2&quot;)</span>
<a name="l00349"></a>00349 <span class="comment">                                alterarMorada();</span>
<a name="l00350"></a>00350 <span class="comment">                        else if(escolha == &quot;3&quot;)</span>
<a name="l00351"></a>00351 <span class="comment">                                alterarMorada_GPS();</span>
<a name="l00352"></a>00352 <span class="comment">                        else if (escolha == &quot;9&quot;)</span>
<a name="l00353"></a>00353 <span class="comment">                                iTex.ajuda(&quot;menuPrincipal&quot;);</span>
<a name="l00354"></a>00354 <span class="comment"></span>
<a name="l00355"></a>00355 <span class="comment">                        else</span>
<a name="l00356"></a>00356 <span class="comment">                        {</span>
<a name="l00357"></a>00357 <span class="comment">                                aMostrar.push_back(&quot;Cliente n�o encontrado&quot;);</span>
<a name="l00358"></a>00358 <span class="comment">                            alterarCliente();</span>
<a name="l00359"></a>00359 <span class="comment">                    }</span>
<a name="l00360"></a>00360 <span class="comment">}*/</span>
<a name="l00361"></a>00361         }
<a name="l00362"></a>00362 
<a name="l00363"></a>00363 
<a name="l00364"></a><a class="code" href="class_empresa.html#a84f868705fc0e2cad181201b79b9ba66">00364</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#a84f868705fc0e2cad181201b79b9ba66">Empresa::desativarCliente</a>()
<a name="l00365"></a>00365 {
<a name="l00366"></a>00366 
<a name="l00367"></a>00367 }
<a name="l00368"></a>00368 
<a name="l00369"></a><a class="code" href="class_empresa.html#af08b4a3b0d5d1e61b5be2c818fcf56e3">00369</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#af08b4a3b0d5d1e61b5be2c818fcf56e3">Empresa::consultarCliente</a>()
<a name="l00370"></a>00370 {
<a name="l00371"></a>00371 
<a name="l00372"></a>00372 }
<a name="l00373"></a>00373 
<a name="l00374"></a><a class="code" href="class_empresa.html#ac8d3747ee3c0b218839a866a2ec4ab7f">00374</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#ac8d3747ee3c0b218839a866a2ec4ab7f" title="Funções relativas a Veiculos.">Empresa::capacidadeVeiculo</a>()
<a name="l00375"></a>00375 {
<a name="l00376"></a>00376 
<a name="l00377"></a>00377 }
<a name="l00378"></a><a class="code" href="class_empresa.html#a74fd5a055a7ecefaf246fce9a838fd01">00378</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#a74fd5a055a7ecefaf246fce9a838fd01">Empresa::clientesAlocados</a>()
<a name="l00379"></a>00379 {
<a name="l00380"></a>00380 
<a name="l00381"></a>00381 }
<a name="l00382"></a><a class="code" href="class_empresa.html#a3eec3ff4dd8f89e9c9222d5c84926e91">00382</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#a3eec3ff4dd8f89e9c9222d5c84926e91">Empresa::sucursalAssociado</a>()
<a name="l00383"></a>00383 {
<a name="l00384"></a>00384 
<a name="l00385"></a>00385 }
<a name="l00386"></a>00386 
<a name="l00387"></a><a class="code" href="class_empresa.html#a0eec8d0106205143940e59f54b3651be">00387</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#a0eec8d0106205143940e59f54b3651be" title="Funções relativas as Sucursais.">Empresa::listaClientes</a>()
<a name="l00388"></a>00388 {
<a name="l00389"></a>00389 
<a name="l00390"></a>00390 }
<a name="l00391"></a>00391 
<a name="l00392"></a><a class="code" href="class_empresa.html#a5a4c537bff70f5d659ff08ee1f498748">00392</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#a5a4c537bff70f5d659ff08ee1f498748">Empresa::veiculoAssociado</a>()
<a name="l00393"></a>00393 {
<a name="l00394"></a>00394 
<a name="l00395"></a>00395 }
<a name="l00396"></a><a class="code" href="class_empresa.html#a99387cca71e4cc5563c3836aabb7ddf7">00396</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#a99387cca71e4cc5563c3836aabb7ddf7">Empresa::desativarSucursal</a>()
<a name="l00397"></a>00397 {
<a name="l00398"></a>00398 
<a name="l00399"></a>00399 }
<a name="l00400"></a>00400 
<a name="l00401"></a><a class="code" href="class_empresa.html#a6b2518be0de3cfe79f94cfaf2c50f0ad">00401</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#a6b2518be0de3cfe79f94cfaf2c50f0ad" title="Funções relativas as Consultas.">Empresa::dadosCliente</a>()
<a name="l00402"></a>00402 {
<a name="l00403"></a>00403 
<a name="l00404"></a>00404 }
<a name="l00405"></a>00405 
<a name="l00407"></a><a class="code" href="class_empresa.html#ae0b426285deeb15319c9d088c0899a8f">00407</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#ae0b426285deeb15319c9d088c0899a8f" title="Futuro algoritmo para todas as rotas necessárias para um dia. Com redistribuição de &#39;serviço&#39; por out...">Empresa::algoritmo2</a>()
<a name="l00408"></a>00408 {
<a name="l00409"></a>00409         cout &lt;&lt; <span class="stringliteral">&quot;Algoritmo2&quot;</span> &lt;&lt; endl;
<a name="l00410"></a>00410 }
<a name="l00411"></a>00411 
<a name="l00413"></a><a class="code" href="class_empresa.html#a53039bc33c57efd950110fb0f9378698">00413</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#a53039bc33c57efd950110fb0f9378698" title="Futuro algoritmo para todas as rotas necessárias para um dia. Com um veículo a realizar várias viagen...">Empresa::algoritmo3</a>()
<a name="l00414"></a>00414 {
<a name="l00415"></a>00415         cout &lt;&lt; <span class="stringliteral">&quot;Algoritmo3&quot;</span> &lt;&lt; endl;
<a name="l00416"></a>00416 }
<a name="l00417"></a>00417 
<a name="l00419"></a>00419 
<a name="l00420"></a>00420 
<a name="l00421"></a><a class="code" href="class_empresa.html#a3ddee1dae5a517442fa258dabf14b9f6">00421</a> <span class="keywordtype">void</span> <a class="code" href="class_empresa.html#a3ddee1dae5a517442fa258dabf14b9f6" title="Funções relativas a Rotas.">Empresa::algoritmo1</a>()
<a name="l00422"></a>00422 {
<a name="l00423"></a>00423         <span class="keywordtype">int</span> mapaX = 932;
<a name="l00424"></a>00424         <span class="keywordtype">int</span> mapaY = 619;
<a name="l00425"></a>00425         <span class="keywordtype">float</span> oeste = -8.63f;
<a name="l00426"></a>00426         <span class="keywordtype">float</span> este = -8.59f;
<a name="l00427"></a>00427         <span class="keywordtype">float</span> norte = 41.19f;
<a name="l00428"></a>00428         <span class="keywordtype">float</span> sul = 41.17f;
<a name="l00429"></a>00429         <span class="keywordtype">char</span> nos[] = <span class="stringliteral">&quot;nodes.txt&quot;</span>;
<a name="l00430"></a>00430         <span class="keywordtype">char</span> ruas[] = <span class="stringliteral">&quot;roads.txt&quot;</span>;
<a name="l00431"></a>00431         <span class="keywordtype">char</span> subruas[] = <span class="stringliteral">&quot;subroads.txt&quot;</span>;
<a name="l00432"></a>00432         vector&lt;int&gt; rota;
<a name="l00433"></a>00433         vector&lt;int&gt; visitar;
<a name="l00434"></a>00434         <span class="comment">//int idRota = 1;</span>
<a name="l00435"></a>00435         vector&lt;no&gt;::iterator pontoMapa;
<a name="l00437"></a>00437         <span class="keywordtype">float</span> dx = fabs(oeste-este)/mapaX;
<a name="l00438"></a>00438         <span class="keywordtype">float</span> dy = fabs(norte-sul)/mapaY;
<a name="l00439"></a>00439 
<a name="l00441"></a>00441         <a class="code" href="classmapa.html" title="Mapa processado a partir dos ficheiros de texto.">mapa</a> *miniMapa = <span class="keyword">new</span> <a class="code" href="classmapa.html" title="Mapa processado a partir dos ficheiros de texto.">mapa</a>(oeste, este, norte, sul, mapaX, mapaY);
<a name="l00442"></a>00442         miniMapa-&gt;<a class="code" href="classmapa.html#afcab2a0230fc1022aa740d701af345b1" title="Leitura dos ficheiros de dados e carregamentos da informação.">processaMapa</a>(nos, ruas, subruas);
<a name="l00443"></a>00443 
<a name="l00446"></a>00446         <span class="comment">// TODO Ler as consultas de um dia e colocar os IDs das localizações no vector &quot;visitar&quot;, até lá fica esta coisa manual.</span>
<a name="l00447"></a>00447         visitar.push_back(25504172);
<a name="l00448"></a>00448         visitar.push_back(26015890);
<a name="l00449"></a>00449         visitar.push_back(26016411);
<a name="l00450"></a>00450         visitar.push_back(420807841);
<a name="l00451"></a>00451         visitar.push_back(430284809);
<a name="l00452"></a>00452         visitar.push_back(1223751653);
<a name="l00453"></a>00453 
<a name="l00455"></a>00455         <a class="code" href="class_graph_viewer.html" title="Código utilizado pelo GraphViewer.">GraphViewer</a> *trajecto = <span class="keyword">new</span> <a class="code" href="class_graph_viewer.html" title="Código utilizado pelo GraphViewer.">GraphViewer</a>(mapaX, mapaY, <span class="keyword">false</span>);
<a name="l00456"></a>00456         trajecto-&gt;<a class="code" href="class_graph_viewer.html#a02437b5fecd8b90de24436068312d593">setBackground</a>(<span class="stringliteral">&quot;map.jpeg&quot;</span>);
<a name="l00457"></a>00457         trajecto-&gt;<a class="code" href="class_graph_viewer.html#ae5247dc66449dcd21fc5d531bbbaddfa">createWindow</a>(mapaX, mapaY);
<a name="l00458"></a>00458 
<a name="l00459"></a>00459         trajecto-&gt;<a class="code" href="class_graph_viewer.html#a4102580b69826ba83251ef7bb262f8be">defineEdgeColor</a>(<span class="stringliteral">&quot;blue&quot;</span>);
<a name="l00460"></a>00460         trajecto-&gt;<a class="code" href="class_graph_viewer.html#a76de8676b7a93d72af514b84cdaa4d21">defineVertexColor</a>(<span class="stringliteral">&quot;lightGray&quot;</span>);
<a name="l00461"></a>00461 
<a name="l00463"></a>00463         miniMapa-&gt;<a class="code" href="classmapa.html#a8b5ad7d946c73aaded28861546357619" title="Iterador para o primeiro elemento do vector de pontos.">planearRotas</a>(&amp;rota, &amp;visitar);
<a name="l00464"></a>00464 
<a name="l00466"></a>00466         <span class="comment">// TODO remover</span>
<a name="l00467"></a>00467 
<a name="l00468"></a>00468         rota.push_back(25504172);
<a name="l00469"></a>00469         rota.push_back(26015890);
<a name="l00470"></a>00470         rota.push_back(26016411);
<a name="l00471"></a>00471         rota.push_back(420807841);
<a name="l00472"></a>00472         rota.push_back(430284809);
<a name="l00473"></a>00473         rota.push_back(1223751653);
<a name="l00474"></a>00474 
<a name="l00475"></a>00475         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> qtdeNos = rota.size();
<a name="l00476"></a>00476         cout &lt;&lt; qtdeNos &lt;&lt; endl;
<a name="l00477"></a>00477 
<a name="l00478"></a>00478         <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; qtdeNos; i++)
<a name="l00479"></a>00479         {
<a name="l00480"></a>00480                 pontoMapa = miniMapa-&gt;<a class="code" href="classmapa.html#a1e5a2eea483d0a946af3f8eaad45bf01" title="Depois de criar um mapa é necessário carregar o mesmo com a informação.">infoNo</a>(rota[i]);
<a name="l00481"></a>00481                 trajecto-&gt;<a class="code" href="class_graph_viewer.html#a5421e86ac76433876309236ba96e70a2">addNode</a>(pontoMapa-&gt;getID(), int(fabs(pontoMapa-&gt;latitude() - oeste) / dx), int(fabs(pontoMapa-&gt;longitude() - norte) / dy));
<a name="l00482"></a>00482         }
<a name="l00483"></a>00483 
<a name="l00484"></a>00484         <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; qtdeNos - 1; i++)
<a name="l00485"></a>00485         {
<a name="l00486"></a>00486                 trajecto-&gt;<a class="code" href="class_graph_viewer.html#aad0c1448c37f744209ffb671f1bd0015">addEdge</a>(i, (miniMapa-&gt;<a class="code" href="classmapa.html#a1e5a2eea483d0a946af3f8eaad45bf01" title="Depois de criar um mapa é necessário carregar o mesmo com a informação.">infoNo</a>(rota[i]))-&gt;getID(), (miniMapa-&gt;<a class="code" href="classmapa.html#a1e5a2eea483d0a946af3f8eaad45bf01" title="Depois de criar um mapa é necessário carregar o mesmo com a informação.">infoNo</a>(rota[i+1]))-&gt;getID(),<a class="code" href="class_edge_type.html#a6533cc56d05c288a550b9980b66c9317">EdgeType::UNDIRECTED</a>);
<a name="l00487"></a>00487         }
<a name="l00488"></a>00488         trajecto-&gt;<a class="code" href="class_graph_viewer.html#aad0c1448c37f744209ffb671f1bd0015">addEdge</a>(qtdeNos, (miniMapa-&gt;<a class="code" href="classmapa.html#a1e5a2eea483d0a946af3f8eaad45bf01" title="Depois de criar um mapa é necessário carregar o mesmo com a informação.">infoNo</a>(rota[qtdeNos - 1]))-&gt;getID(), (miniMapa-&gt;<a class="code" href="classmapa.html#a1e5a2eea483d0a946af3f8eaad45bf01" title="Depois de criar um mapa é necessário carregar o mesmo com a informação.">infoNo</a>(rota[0]))-&gt;getID(),<a class="code" href="class_edge_type.html#a6533cc56d05c288a550b9980b66c9317">EdgeType::UNDIRECTED</a>);  <span class="comment">// Ligar último ao primeiro.</span>
<a name="l00489"></a>00489 
<a name="l00490"></a>00490         trajecto-&gt;<a class="code" href="class_graph_viewer.html#a3009a66958686ccb7e78b68e37c3c423">rearrange</a>();
<a name="l00491"></a>00491         getchar();
<a name="l00492"></a>00492 
<a name="l00493"></a>00493         <a class="code" href="class_empresa.html#a9692aa887b6e73477b35b3356ec64a0b">gestaoRotas</a>();
<a name="l00494"></a>00494 }
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="_empresa_8cpp.html">Empresa.cpp</a>      </li>
      <li class="footer">Gerado em Fri May 13 2011 02:00:24 para Grupo12daturma2MIEIC4 por&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>Tudo</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Ficheiros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Funções</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variáveis</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Amigos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Macros</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


</body>
</html>
